/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * FrameBiblioteca.java
 *
 * Created on 15/04/2012, 19:17:44
 */

package br.edu.fatec.ads.view;

import br.edu.fatec.ads.util.FrameUtil;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;

/**
 *
 * @author Ubirajara
 */
public class FrameBiblioteca extends javax.swing.JInternalFrame {

    /** Creates new form FrameBiblioteca */
    public FrameBiblioteca() {
        initComponents();

        FrameUtil.getInstance().removerBarraTitulo(this);

        this.setVisible(true);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        java.awt.GridBagConstraints gridBagConstraints;

        btnCadastroLivro = new javax.swing.JButton();
        btnPesquisaLivro = new javax.swing.JButton();
        btnAtualizaLivro = new javax.swing.JButton();
        lblCadastroLivro = new javax.swing.JLabel();
        lblPesquisaLivro = new javax.swing.JLabel();
        lblAtualizaLivro = new javax.swing.JLabel();
        btnCadastroEmprestimo = new javax.swing.JButton();
        lnlCadastroEmprestimo = new javax.swing.JLabel();
        btnConsultarEmprestimo = new javax.swing.JButton();
        lblConsultarEmprestimo = new javax.swing.JLabel();
        btnBaixaEmprestimo = new javax.swing.JButton();
        lblBaixaEmprestimo = new javax.swing.JLabel();
        sprLivros = new javax.swing.JSeparator();
        sprEmprestimos = new javax.swing.JSeparator();

        setForeground(java.awt.Color.white);
        setAlignmentX(0.0F);
        setAlignmentY(0.0F);
        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        setMinimumSize(new java.awt.Dimension(800, 500));
        setPreferredSize(new java.awt.Dimension(800, 500));
        getContentPane().setLayout(new java.awt.GridBagLayout());

        btnCadastroLivro.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/edu/fatec/ads/image/book.png"))); // NOI18N
        btnCadastroLivro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCadastroLivroActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(0, 38, 0, 0);
        getContentPane().add(btnCadastroLivro, gridBagConstraints);

        btnPesquisaLivro.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/edu/fatec/ads/image/search-icon.png"))); // NOI18N
        btnPesquisaLivro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPesquisaLivroActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 4;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(0, 35, 0, 0);
        getContentPane().add(btnPesquisaLivro, gridBagConstraints);

        btnAtualizaLivro.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/edu/fatec/ads/image/1335125211_update.png"))); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 8;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(0, 40, 0, 0);
        getContentPane().add(btnAtualizaLivro, gridBagConstraints);

        lblCadastroLivro.setText("Cadastro de Livros");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(20, 25, 0, 0);
        getContentPane().add(lblCadastroLivro, gridBagConstraints);

        lblPesquisaLivro.setText("Pesquisa de Livros");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 4;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(20, 25, 0, 0);
        getContentPane().add(lblPesquisaLivro, gridBagConstraints);

        lblAtualizaLivro.setText("Atualização de Dados");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 8;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(20, 25, 0, 0);
        getContentPane().add(lblAtualizaLivro, gridBagConstraints);

        btnCadastroEmprestimo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/edu/fatec/ads/image/library.png"))); // NOI18N
        btnCadastroEmprestimo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCadastroEmprestimoActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(50, 38, 0, 0);
        getContentPane().add(btnCadastroEmprestimo, gridBagConstraints);

        lnlCadastroEmprestimo.setText("Cadastro de Empréstimo");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 4;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(20, 20, 0, 0);
        getContentPane().add(lnlCadastroEmprestimo, gridBagConstraints);

        btnConsultarEmprestimo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/edu/fatec/ads/image/search-icon.png"))); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 4;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(50, 35, 0, 0);
        getContentPane().add(btnConsultarEmprestimo, gridBagConstraints);

        lblConsultarEmprestimo.setText("Consultar Empréstimos");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 4;
        gridBagConstraints.gridy = 4;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(20, 20, 0, 0);
        getContentPane().add(lblConsultarEmprestimo, gridBagConstraints);

        btnBaixaEmprestimo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/edu/fatec/ads/image/paper-back-icone-5176-32.png"))); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 8;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(50, 40, 0, 0);
        getContentPane().add(btnBaixaEmprestimo, gridBagConstraints);

        lblBaixaEmprestimo.setText("Devolução de Empréstimos");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 8;
        gridBagConstraints.gridy = 4;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(20, 18, 0, 0);
        getContentPane().add(lblBaixaEmprestimo, gridBagConstraints);

        sprLivros.setPreferredSize(new java.awt.Dimension(420, 10));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.gridwidth = 13;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(6, 10, 0, 60);
        getContentPane().add(sprLivros, gridBagConstraints);

        sprEmprestimos.setPreferredSize(new java.awt.Dimension(420, 10));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 5;
        gridBagConstraints.gridwidth = 13;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(6, 10, 0, 60);
        getContentPane().add(sprEmprestimos, gridBagConstraints);

        setLocation(new java.awt.Point(0, 0));
    }// </editor-fold>//GEN-END:initComponents

    private void btnCadastroLivroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCadastroLivroActionPerformed
        this.adicionarInternalFrame(new FrameAdicionarLivro(), "Cadastro de Livros");
    }//GEN-LAST:event_btnCadastroLivroActionPerformed

    private void btnCadastroEmprestimoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCadastroEmprestimoActionPerformed
        this.adicionarInternalFrame(new FrameAdicionarEmprestimo(), "Cadastro de Empréstimos");
    }//GEN-LAST:event_btnCadastroEmprestimoActionPerformed

    private void btnPesquisaLivroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPesquisaLivroActionPerformed
        this.adicionarInternalFrame(new FramePesquisarLivro(), "Consulta de Publicações");
    }//GEN-LAST:event_btnPesquisaLivroActionPerformed

    private void adicionarInternalFrame(JInternalFrame frame, String name){
        frame.setSize(this.getDesktopPane().getSize());
        frame.setResizable(!rootPaneCheckingEnabled);

        this.getDesktopPane().add(frame);
        this.getDesktopPane().moveToFront(frame);

        JFrame parent = (JFrame) this.getDesktopPane().getTopLevelAncestor();
        parent.setTitle(parent.getTitle() + " - " + name);
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnAtualizaLivro;
    private javax.swing.JButton btnBaixaEmprestimo;
    private javax.swing.JButton btnCadastroEmprestimo;
    private javax.swing.JButton btnCadastroLivro;
    private javax.swing.JButton btnConsultarEmprestimo;
    private javax.swing.JButton btnPesquisaLivro;
    private javax.swing.JLabel lblAtualizaLivro;
    private javax.swing.JLabel lblBaixaEmprestimo;
    private javax.swing.JLabel lblCadastroLivro;
    private javax.swing.JLabel lblConsultarEmprestimo;
    private javax.swing.JLabel lblPesquisaLivro;
    private javax.swing.JLabel lnlCadastroEmprestimo;
    private javax.swing.JSeparator sprEmprestimos;
    private javax.swing.JSeparator sprLivros;
    // End of variables declaration//GEN-END:variables

}
